#ifndef OPERATIONFACTORY_H
#define OPERATIONFACTORY_H

#include "operation.h"

class OperationFactory
{
public:
    static Operation* createOperation(const std::string& sOperator)
    {
        Operation *operation = nullptr;
        if (sOperator.compare("+") == 0)
            operation = new Add();
        else if (sOperator.compare("-") == 0)
            operation = new Subtract();
        else if (sOperator.compare("*") == 0)
            operation = new Multiply();
        else if (sOperator.compare("/") == 0)
            operation = new Divide();
        else
            throw std::invalid_argument("Your input is out of my range.");

        return operation;
    }
};

#endif
